package com.mine.redis.util.controller;

import com.mine.redis.util.bean.BlogDO;
import com.mine.redis.util.bean.ScrollPage;
import com.mine.redis.util.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author weixiao
 * @date 2024/8/19 15:24
 */
@RestController
@RequestMapping("/blog")
public class BlogController {

    @Autowired
    private BlogService blogService;

    @PostMapping("/post")
    public void post(@RequestBody BlogDO blog) {
        blogService.post(blog);
    }

    @GetMapping("/getBlogList")
    public ScrollPage<BlogDO> getBlogList(@RequestParam("userId") Integer userId,
                                          @RequestParam("lastScore") Long lastScore,
                                          @RequestParam("offset") Integer offset) {
        return blogService.getBlogList(userId, lastScore, offset);
    }
}
